<?php

class Kernel_Form_Order_Simple extends Kernel_Form_Order_Abstract 
{
    
    /**
    * @desc Add node to the specified position. 
    * 
    * @param integer $position 
    * @param array $addit_values = array() 
    */
    public function addNode($position, $addit_values = array()) 
    {
        return $this->_addNode($position, $addit_values);
    }
    
    /**
    * @desc Move specified node on position specified.
    * 
    * @param integer $_id
    * @param integer $_position
    */
    public function moveNode($_id, $_position) 
    {
        $this->_moveNode($_id, $_position);
    }
    
    /**
    * @desc Delete node specified. 
    * 
    * @param integer $id
    */
    public function deleteNode($id) 
    {
        return $this->_deleteNode($id);
    }
    
    /**
     * @desc Form SQl statement. 
     *
     * @return  string
     */
    protected function _getQueryBody() 
    {
        $query = '
            SELECT 
                   `' . $this->id_field . '` 
              FROM 
                   `' . $this->table . '`'; 
        if (!is_null($this->condition)) {
            $query .= '
             WHERE 
                ' . database::condition($this->condition);
        }
        $query .= '
          ORDER BY 
                   `'. $this->pos_field . '`
               ASC 
            ';
        return $query;
    }
    
}